# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=ssss
pkgver=0.5.7
pkgrel=0
pkgdesc="ssss is an implementation of Shamir's secret sharing scheme for UNIX systems"
url="http://point-at-infinity.org/ssss/"
arch="all"
license="GPL-2.0-only"
makedepends="make xmltoman gmp-dev"
subpackages="$pkgname-doc"
source="https://github.com/MrJoy/ssss/archive/releases/v$pkgver/ssss-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-releases-v$pkgver"

build() {
	make
}

check() {
	local rand=$(cat /proc/sys/kernel/random/uuid)
	local combined=$(echo "$rand" | ./ssss-split -q -t 2 -n 3 | tail -n 2 | ./ssss-combine -q -t 2)
	test "$combined" = "$rand"
}

package() {
	install -d "$pkgdir"/usr/share/man/man1
	install -m644 ssss.1 ssss-split.1 ssss-combine.1 "$pkgdir"/usr/share/man/man1
	install -m755 -D ssss-split "$pkgdir"/usr/bin/ssss-split
	ln -s ssss-split "$pkgdir"/usr/bin/ssss-combine
}
sha512sums="
aca85b7a63e6d009fffe5540b0c8e3190c364aa2070e8d8487fd42d7ac76143e404b226b28f3630022d102679371673cc7c08b8c5d3bcf63e3676b7293d2ba00  ssss-0.5.7.tar.gz
"
